From 2ead380f76e6b6f40d6ab8f8922c4463a20781e3 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 19 Aug 2014 13:10:55 -0700 Subject: [PATCH] Fix doc tests for libs with deps The movement of tests to the main `target` directory forgot to update a spot where rustdoc used a -L flag. --- src/cargo/ops/cargo_test.rs | 4 ++-- tests/test_cargo_test.rs | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/cargo/ops/cargo_test.rs b/src/cargo/ops/cargo_test.rs index 31e82700a..b48641e33 100644 --- a/src/cargo/ops/cargo_test.rs +++ b/src/cargo/ops/cargo_test.rs @@ -46,8 +46,8 @@ pub fn run_tests(manifest_path: &Path, let mut p = compile.process("rustdoc") .arg("--test").arg(lib) .arg("--crate-name").arg(name) - .arg("-L").arg("target/test") - .arg("-L").arg("target/test/deps") + .arg("-L").arg(&compile.root_output) + .arg("-L").arg(&compile.deps_output) .cwd(package.get_root()); // FIXME(rust-lang/rust#16272): this should just always be passed. diff --git a/tests/test_cargo_test.rs b/tests/test_cargo_test.rs index aedacc494..38980e77f 100644 --- a/tests/test_cargo_test.rs +++ b/tests/test_cargo_test.rs @@ -226,13 +226,14 @@ test!(test_with_deep_lib_dep { [dependencies.foo] path = "../foo" - - [lib] - name = "bar" - doctest = false "#) .file("src/lib.rs", " extern crate foo; + /// ``` + /// bar::bar(); + /// ``` + pub fn bar() {} + #[test] fn bar_test() { foo::foo(); @@ -265,8 +266,16 @@ test bar_test ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +{doctest} bar + +running 1 test +test bar_0 ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured + ", compiling = COMPILING, running = RUNNING, + doctest = DOCTEST, dir = p.url()).as_slice())); }) -- 2.30.2